//
// Created by liangwenhao on 2024/4/4.
//

#ifndef _BSP_CAN_H
#define _BSP_CAN_H
#include "can.h"
#include "stm32f4xx.h"
//发送和接收结构体，包括ID和数据
typedef struct
{
    uint16_t ReceiveID;
    uint8_t ReceiveData[8];
}CAN_Receive;

typedef struct
{
    uint32_t SendID;
    uint8_t SendData[8];
}CAN_Send;
#include "motor_driver.h"
extern Motor YawMotor,LoadMotor1,LoadMotor2,LocateMotor,LoadMotor3,LoadMotor4,LoadMotor5;
extern CAN_Send can1Tx_0x200;
extern CAN_Send can2Tx_0x200;
uint8_t UserCan2FilterConfig(void);
uint8_t UserCan1FilterConfig(void);
void CAN12_FilterInitAndStart(void);
void CAN_Send_Init(CAN_Send * can_send);
void CAN_Receive_Init(CAN_Receive * can_receive);
uint8_t CAN2_Send_Msg(CAN_Send * can_send,uint8_t len);
uint8_t CAN1_Send_Msg(CAN_Send * can_send,uint8_t len);
uint8_t CAN2_Receive_Msg(CAN_Receive * can_receive);
uint8_t CAN1_Receive_Msg(CAN_Receive * can_receive);
void CAN1_INTERRUPT(CAN_Receive *can_receive);
void CAN2_INTERRUPT(CAN_Receive *can_receive);
#endif //_BSP_CAN_H
